Skip to content

fix(server): preserve spaces in workflow store keys and prefixes - #41318

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-workflow-store-key-spaces
Nov 23, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-workflow-store-key-spaces

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

t3 workflow store list 'team ' should list only keys that start with team (with the space), but it also lists team-private. And t3 workflow store set ' key ' 3 prints Set key . while the store saves the key as key.

Change

The t3_workflow tool decoded key with TrimmedNonEmptyString, so spaces at either end were dropped before the store's exact-key match and prefix range. key now uses the same check that #41260 gave wait: the value is kept as sent, and a blank value is still rejected. The two fields share that schema. The advertised tool schema is unchanged.

Scope

Bug fix: store keys and list prefixes lose their leading and trailing spaces. It is a one-schema fix with a standalone repro below, so it needs no issue.

Verification

Linux repro: save as repro.sh and run bash repro.sh from a checkout with dependencies installed and jq (no account or provider needed)
scratch=$(mktemp -d); export T3CODE_HOME=$scratch/state T3CODE_WORKFLOWS=$scratch/workflows T3_CLI=$PWD/apps/server/src/bin.ts
mkdir -p "$T3CODE_HOME/userdata" "$T3CODE_WORKFLOWS" "$scratch/project" "$scratch/bin"
echo '{"workflowsEnabled":true}' > "$T3CODE_HOME/userdata/settings.json"
echo 'export default T3.workflow("noop", {version: 1, payload: Schema.Struct({})}, Effect.fn(function* () {}));' > "$T3CODE_WORKFLOWS/noop.ts"
printf '#!/bin/sh\nexec node "$T3_CLI" "$@"\n' > "$scratch/bin/t3"; chmod +x "$scratch/bin/t3"; PATH=$scratch/bin:$PATH
t3 serve --port 15345 --no-browser "$scratch/project" > "$scratch/server.log" 2>&1 & server=$!
trap 'kill "$server"' EXIT
ready=$T3CODE_HOME/userdata/server-runtime.json
for _ in $(seq 60); do [ -f "$ready" ] && break; sleep 1; done
[ -f "$ready" ] || { cat "$scratch/server.log"; exit 1; }
PS4='$ '
(
set -exo pipefail
t3 workflow store set 'team A' 1
t3 workflow store set 'team-private' 2
t3 workflow store list 'team ' --json | jq -c 'map(.key)'
t3 workflow store set ' key ' 3
t3 workflow store list --json | jq -c 'map(.key)'
t3 workflow store delete ' key '
t3 workflow store list --json | jq -c 'map(.key)'
)

Setup: Ubuntu 26.04, Node 26.13.1, real t3 serve with fresh isolated state on each run. The base run used tools.ts from 135c78a, the only non-test file the fix changes.
Steps (the transcripts are the script's full output): set team A and team-private → list prefix 'team ' → set ' key ' → list all → delete ' key ' → list all.

135c78a (base):

$ t3 workflow store set 'team A' 1
Set team A.
$ t3 workflow store set team-private 2
Set team-private.
$ t3 workflow store list 'team ' --json
$ jq -c 'map(.key)'
["team A","team-private"]
$ t3 workflow store set ' key ' 3
Set  key .
$ t3 workflow store list --json
$ jq -c 'map(.key)'
["key","team A","team-private"]
$ t3 workflow store delete ' key '
Deleted  key .
$ t3 workflow store list --json
$ jq -c 'map(.key)'
["team A","team-private"]

071524c (fix):

$ t3 workflow store set 'team A' 1
Set team A.
$ t3 workflow store set team-private 2
Set team-private.
$ t3 workflow store list 'team ' --json
$ jq -c 'map(.key)'
["team A"]
$ t3 workflow store set ' key ' 3
Set  key .
$ t3 workflow store list --json
$ jq -c 'map(.key)'
[" key ","team A","team-private"]
$ t3 workflow store delete ' key '
Deleted  key .
$ t3 workflow store list --json
$ jq -c 'map(.key)'
["team A","team-private"]

An AI agent ran every check: the extended test in tools.test.ts fails on 135c78a (expected 'team' to be 'team ') and passes on 071524c, and vp run check:changed passes. Newer main (9f24cac) has not changed these files.

Links: regression test

Not shown

  • macOS and Windows. The fix is a schema decode with no platform-specific code.

Generated with Claude Opus 5.5 in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The workflow toolkit now uses shared validation for wait names and store keys. Accepted values retain their original whitespace, while whitespace-only values are rejected. Tests cover both fields.

Changes: Workflow name validation

Layer / File(s) Summary
Validate exact names
apps/server/src/mcp/toolkits/workflow/tools.ts, apps/server/src/mcp/toolkits/workflow/tools.test.ts
A shared schema rejects whitespace-only values without trimming accepted values. The wait and key fields use this schema. Tests verify trailing spaces are preserved and whitespace-only values are rejected.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · up to 93788

Merge Risk: ⚪ Minimal · up to 93788

Workflow store keys and prefixes now keep their leading and trailing spaces, and blank keys are still rejected. Callers must send a nonblank key. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the workflow store key and prefix handling now keeps leading and trailing spaces. It follows the conventional commit form and matches the raw summary, which describes …
Description check Passed The description covers the problem, the change, scope, and verification. It follows the template sections: Problem, Change, Scope, and Verification. It gives a repro, before and after transcripts, and…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the workflow store key and prefix handling now keeps leading and trailing spaces. It follows the conventional commit form and matches the raw summary, which describes the ExactName schema for wait and key and the tests for store keys.

Full details: Description check

Explanation

The description covers the problem, the change, scope, and verification. It follows the template sections: Problem, Change, Scope, and Verification. It gives a repro, before and after transcripts, and test results. It states what was not checked (macOS and Windows). The description also says the author's own test fails on the base commit and passes on the fix commit. The template asks for a conventional commit title in the header comment, and the title meets that. The description has no separate screenshot section, but this is a non-UI change, so that is not needed.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 65cd644 and 071524c.

Files selected for processing: 2

  • apps/server/src/mcp/toolkits/workflow/tools.test.ts
  • apps/server/src/mcp/toolkits/workflow/tools.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 23, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Real server/CLI proof on Linux, with fresh isolated homes, workflows enabled and a noop workflow loaded on both commits. Set team A and team-private, list prefix 'team ', set ' key ', list, delete ' key ', and list again. Also verify a whitespace-only key is rejected.

Before After
65cd644623 9378891437
Before: captured CLI output After: captured CLI output
Prefix incorrectly includes team-private; padded key becomes key. Prefix returns only team A; padded key remains key.

Whitespace-only keys remain invalid. Images render actual command output. Before transcript, after transcript, reproduction driver.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 23, 2026
@juliusmarminge
juliusmarminge merged commit f0d160f into pingdotgg:main Nov 23, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants